/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.exam.exam.service;
 
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.bussiness.exam.exam.domain.Exam;
import com.seeyoui.kensite.bussiness.exam.exam.persistence.ExamMapper;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;

/**
 * Exam
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-01-10
 */

@Service
public class ExamService extends BaseService {
	
	@Autowired
	private ExamMapper examMapper;

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public Exam findOne(String id) throws CRUDException{
		return examMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param exam
	 * @return
	 * @throws CRUDException
	 */
	public List<Exam> findList(Exam exam) throws CRUDException {
		return examMapper.findList(exam);
	}
	
	/**
	 * 查询所有数据集合
	 * @param exam
	 * @return
	 * @throws CRUDException
	 */
	public List<Exam> findAll(Exam exam) throws CRUDException {
		return examMapper.findAll(exam);
	}
	
	/**
	 * 查询数据总数
	 * @param exam
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(Exam exam) throws CRUDException {
		return examMapper.findTotal(exam);
	}
	
	/**
	 * 查询数据总数排除当前数据
	 * @param exam
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(Exam exam) throws CRUDException {
		return examMapper.findExTotal(exam);
	}
	
	/**
	 * 数据新增
	 * @param exam
	 * @throws CRUDException
	 */
	public void save(Exam exam) throws CRUDException{
		exam.preInsert();
		examMapper.save(exam);
	}
	
	/**
	 * 数据修改
	 * @param exam
	 * @throws CRUDException
	 */
	public void update(Exam exam) throws CRUDException{
		exam.preUpdate();
		examMapper.update(exam);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		examMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param exam
	 * @throws CRUDException
	 */
	public void remove(Exam exam) throws CRUDException{
		exam.preUpdate();
		examMapper.remove(exam);			
	}
}